Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/add event testing #71

Merged
merged 4 commits into from
Feb 21, 2025

Conversation

tinkerer-shubh
Copy link
Contributor

Fixes: #68

This PR enhances the test coverage for event emissions in the fungible token implementation. It adds comprehensive testing for event topics and data in the following test cases:

  • transfer_works(): Test transfer and mint events
  • burn_works(): Test mint and burn events
  • mint_works(): Test mint event

The changes include:

  1. New EventAssertion utility for consistent event testing
  2. Comprehensive assertions for event topics and data
  3. Clear error messages for failed assertions

PR Checklist

  • Tests
    • Added event testing utilities
    • Enhanced existing test cases with event assertions
    • All tests passing
  • Documentation
    • Added code comments explaining event validation
    • No API changes requiring documentation updates

@ozgunozerk
Copy link
Collaborator

@tinkerer-shubh thanks a lot for this!
We will review it shortly 🚀

Copy link
Collaborator

@ozgunozerk ozgunozerk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing, loved it!

My only suggestion would be:

  • to not add new tests burn_works() and mint_works() to Fungible tests.
  • we already have burn_works() and mint_works() .
  • you can use this new utility in those tests, would suit the structure of this repo better that way

Thanks a lot for this utility, we will definitely use it!

@tinkerer-shubh
Copy link
Contributor Author

tinkerer-shubh commented Feb 17, 2025

@ozgunozerk Thanks for the feedback! I’ve updated the existing burn_works() and mint_works() tests to use the new utility instead of adding new ones. I also made a few additional improvements—let me know if you’d like me to tweak anything further!

Copy link
Collaborator

@ozgunozerk ozgunozerk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

I have only one request regarding the added comment.
Code wise, I'm super happy with the changes 💯

Thanks again 🙏

@ozgunozerk
Copy link
Collaborator

@tinkerer-shubh seems like cargo fmt is failing. Feel free to see which tests are run in the CI from the workflow file itself, or in CONTRIBUTING.md

@tinkerer-shubh
Copy link
Contributor Author

tinkerer-shubh commented Feb 19, 2025

LGTM!

I have only one request regarding the added comment. Code wise, I'm super happy with the changes 💯

Thanks again 🙏

@ozgunozerk Happy to contribute! I've made the requested changes—let me know if anything else needs tweaking. I also ran all the tests (had missed one earlier), so the checks should pass now. Thanks again for the review! 🙌

@ozgunozerk ozgunozerk merged commit e08ebc4 into OpenZeppelin:main Feb 21, 2025
2 checks passed
@tinkerer-shubh tinkerer-shubh deleted the feat/add-event-testing branch February 22, 2025 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🎁 [Feature Request]: Add missing events tests
3 participants